package cn.zzdt4j.config.springboot.starter.config;

import cn.zzdt4j.config.springboot.starter.monitor.ThreadPoolMonitorExecutor;
import cn.zzdt4j.threadpool.dynamic.model.config.properties.BootstrapConfigProperties;
import lombok.AllArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Monitor configuration
 *
 * @author by <a href="mailto:ligang941012@gmail.com">gang.Li</a>
 * @since 2024/5/13 23:49
 */
@Configuration
@AllArgsConstructor
@EnableConfigurationProperties(SpringBootstrapConfigProperties.class)
public class MonitorConfiguration {

    private final BootstrapConfigProperties bootstrapConfigProperties;

    @Bean
    public ThreadPoolMonitorExecutor zzdt4jDynamicThreadPoolMonitorExecutor() {
        return new ThreadPoolMonitorExecutor(bootstrapConfigProperties);
    }
}
